/**
 * 
 */
package models;

import java.sql.SQLException;

//import com.j256.ormlite.dao.RuntimeExceptionDao;
//import com.j256.ormlite.field.DatabaseField;
//import com.j256.ormlite.misc.RuntimeExceptionBaseDaoEnabled;
//import com.j256.ormlite.table.DatabaseTable;

/**
 * This class represents the priority model for TaskFudger.
 * 
 * @author Grishma Patel
 *
 */
//@DatabaseTable(tableName = "priorities")
public class Priority// extends RuntimeExceptionBaseDaoEnabled<Priority, Integer>
{
	//@DatabaseField(generatedId = true)
	private int id;
	
	//@DatabaseField
	private int value;
	
	//@DatabaseField(canBeNull = true, foreignAutoRefresh = true, foreign = true)
    private Task task;
	
	public Task getTask() {
		return task;
	}

	public void setTask(Task task) {
		this.task = task;
	}

	public static final String [] priorityStrings = {"Paramount", "Important", "Meddling", "Trivial", "Inconsequential"};

	// For ORMLite DAO access
	//private static RuntimeExceptionDao<Priority, Integer> defaultDao = null;
	
//	public static void setDefaultDao(RuntimeExceptionDao<Priority, Integer> dao) 
//	{
//		defaultDao = dao;
//	}
//	
//	public static RuntimeExceptionDao<Priority, Integer> getDefaultDao()
//	{
//		return defaultDao;
//	}
	
	/**
	 * Zero-arg constructor, specifically for ORMlite
	 * @throws SQLException 
	 */
	public Priority()
	{
		super();
		//setDao(defaultDao);
	}
	
	/**
	 * Overloaded constructor. Initializes value.
	 * @param value
	 */
	public Priority(int value)
	{
		this.value = value;
	}
	
	/**
	 * getters and setters for value.
	 * @return
	 */
	public int getValue()
	{
		return value;
	}
	
	public void setValue(int value)
	{
		this.value = value;
	}
	
	/**
	 * getter for id
	 * @return
	 */
	public int getId()
	{
		return id;
	}
	
	/**
	 * Returns the String name of the priority based 
	 * on the numerical priority value.
	 */
	public String toString()
	{
		String str = priorityStrings[value - 1];
		return str;
	}
	

}
